<template>
  <div>
    <info-view :related-data="relatedData" v-if="isNormal"></info-view>
    <business-info :query-id="queryId" v-else-if="isClass"></business-info>
    <base-info :query-id="queryId" v-else></base-info>
  </div>
</template>

<script>
import InfoView from '@/credit/views/city/bus/normal/Info'
import BaseInfo from '@/gov/views/bus/import/xinnong/components/Base'
import BusinessInfo from '@/gov/views/bus/import/class/MainBusinessView'
export default {
  components: {
    InfoView,
    BaseInfo,
    BusinessInfo,
  },
  props: {
    relatedData: {
      type: Object,
      default: () => ({}),
    },
  },
  data() {
    return {}
  },
  computed: {
    queryId() {
      if (this.isNormal) {
        return this.relatedData.customer_related_id
      } else {
        return this.isClass
          ? this.relatedData.credit_industrial_id
          : this.relatedData.credit_direct_id
      }
    },
    isClass() {
      return +this.relatedData.credit_type === 1
    },
    isNormal() {
      return !this.relatedData.credit_direct_id && !this.relatedData.credit_industrial_id
    },
  },
  watch: {},
  created() {},
  mounted() {},
  methods: {},
}
</script>

<style lang="scss" scoped></style>
